/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sk.lieskove.jianghongtiao.paris.webclient.web;

import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.UrlBinding;
import net.sourceforge.stripes.integration.spring.SpringBean;
import sk.lieskove.jianghongtiao.paris.webclient.model.DocumentManager;
import sk.lieskove.jianghongtiao.paris.webclient.persistence.ClassificationItem;

import java.util.List;

/**
 *
 * @author xjuraj
 */
@UrlBinding(value="/list/{$event}")
public class ListActionBean extends AbstractActionBean {

    @SpringBean
    private DocumentManager documentManager;
    private List<ClassificationItem> classificationItems;

    @DefaultHandler
    public final Resolution notProcessed() {
        log.debug("ListActionBean using default handler");
        classificationItems = documentManager.getNotProcessed();
        return new ForwardResolution("/WEB-INF/pages/list.jsp");
    }
    
    public final Resolution all() {
        log.debug("ListActionBean using default handler");
        classificationItems = documentManager.getAllDocuments();
        return new ForwardResolution("/WEB-INF/pages/list.jsp");
    }

    public List<ClassificationItem> getClassificationItems() {
        return classificationItems;
    }

    public void setClassificationItems(List<ClassificationItem> classificationItems) {
        this.classificationItems = classificationItems;
    }

    public DocumentManager getDocumentManager() {
        return documentManager;
    }

    public void setDocumentManager(DocumentManager documentManager) {
        this.documentManager = documentManager;
    }
}
